package com.v5ba.sms;

import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @author yiren
 * @since 2022/7/8
 */
@Configuration
public class MyConfiguration {
    @Bean
    @ConditionalOnProperty(prefix = "com.v5ba", name = "url")
    public SmsProperties smsProperties(){
        return new SmsProperties();
    }

    @Bean
    // @ConditionalOnBean(name = {"smsProperties"})
    // @ConditionalOnBean({SmsProperties.class})
    @Conditional({MyCondition.class})
    public SmsUtil smsUtil(SmsProperties smsProperties){
        return new SmsUtil(smsProperties);
    }
}
